#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import orm
import asyncio
from models import User


async def main(loop):
    await orm.create_pool(loop, **database)
    user = User()
    user.name = 'ZhouXiaorui_miao'
    user.email = '12443@sina.com'
    user.passwd = '123456'
    user.image = 'about:blank'
    await user.save()
    return user.name

loop = asyncio.get_event_loop()
database = {
    'host':'127.0.0.1', #数据库的地址
    'user':'root',
    'password':'123456',
    'db':'awesome'
}

task = asyncio.ensure_future(main(loop))

res = loop.run_until_complete(task)
print(res)
